﻿using JustMetClient.Commons;
using JustMetClient.Modules.LoginModule;
using JustMetClient.Modules.SocketModule;
using JustMetClient.Modules.WebModule;
using JustMetClient.Socket.Models;
using Azylee.Core.DataUtils.StringUtils;
using Azylee.Core.IOUtils.TxtUtils;
using Azylee.Core.NetUtils;
using Azylee.Core.Plus.DataUtils.JsonUtils;
using Azylee.YeahWeb.BaiDuWebAPI.IPLocationAPI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JustMetClient.Modules.PlanTaskModule
{
    public class PlanTaskM1
    {
        /// <summary>
        /// 1分钟任务
        /// </summary>
        public static void Do()
        {
            //请求版本号
            SocketSendQueue.Add(MessageType.请求新版本号, new string[] { R.Version.ToString() }, 60);
            SocketSendQueue.Add(MessageType.网络认证状态, new string[] {
                R.Socket.IsConnect?"1":"0",//session连接
                R.Flag.IsAuthOk?"1":"0",//认证信息
                "9"
            });

            //仅在自动登录时，进行自动登录、掉线重登
            if (R.Flag.AutoLogin)
            {
                if (R.Flag.IsAuthOk)
                {
                    //if (Str.Ok(R.NetInfo.Gateway))
                    //{
                    //if (PingTool.Ping(R.NetInfo.Gateway))
                    //{
                    //    R.Flag.IsCheck802 = true;
                    //}
                    //else
                    //{
                    //    R.Flag.IsCheck802 = false;
                    //    //掉线重登
                    //    if (LoginHelper.AutoLogin()) R.Toast.AutoShow("提示", "网络认证成功：" + R.UserName);
                    //}
                    //}
                }
                else
                {
                    //自动登录
                    //if (LoginHelper.AutoLogin()) R.Toast.AutoShow("提示", "网络认证成功：" + R.Account);
                }
            }
        }
    }
}
